<?php
	include_once dirname(dirname(dirname(__FILE__))).'/inc/bootConfig.php';
	include_once '../checkLogin.php';
	$action = getRequest('act');
	$id = getRequest('id');
	if(!empty($action) && !empty($id)){
		if($action == 'del'){
			Module_Edit::delete('zjx_product','p_id='.$id);	
			Cache_Filecache::delFileCache();
		}
	}
	$allPro = Module_Select::getAllProductInfo();
	$modinfo = Module_Select::getModarr('z_url=\'product\'');
//	var_dump($modinfo);
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>查看内容</title>
<link rel="stylesheet" type='text/css' href='../Public/static/css/admincp/admincp.css'>
</head>
<body>
<div id="cpcontainer" class="container">
	<div class="floattop">
		<div class="itemtitle">
			<h3>已发布产品管理</h3>
		</div>
	</div>
<div id="threadlist">
<div class="floattopempty"></div>
<form action='' method='post'>
<table class="tb tb2 nobdb">
	<tbody>
		<tr>
			<th class="partition" colspan="15">共发布&nbsp;<?php echo count($allPro)?>&nbsp;个产品</th>
		</tr>
		<tr class="header">
			<th width="20px"></th>
			<th width="100px">版块</th>
			<th width="20%">标题</th>
			<th width="30%">内容简要</th>
			<th>最后修改人</th>
			<th>最后修改时间</th>
			<th>操作</th>
		</tr>
<?php 
	if(is_array($allPro) && count($allPro)>0){
		foreach ($allPro as $v){
?>
		<tr class="hover">
			<td class="td25"><input type="radio" value="<?php echo $v['p_id']?>" name="content" class="checkbox"></td>
			<td><a target="_blank" href="/www/showmod/index/modid/<?php echo $v['p_mid']?>/mean/product.htm"><?php echo $modinfo[$v['p_mid']]?></a></td>
			<td><a title="<?php echo $v['p_name']?>" href="/admin/zjxad/module/product_add.php?id=<?php echo $v['p_id']?>"><?php echo msubstr(strip_tags($v['p_name']),0,20)?></a></td>
			<td><a title="<?php echo strip_tags($v['p_info'])?>" href="/admin/zjxad/module/product_add.php?id=<?php echo $v['p_id']?>"><?php echo msubstr(strip_tags($v['p_info']),0,25)?></a></td>
			<td><a><?php echo $v['p_user']?></a></td>
			<td><?php echo $v['p_time']?></td>
			<td><a href="attr_watch.php?id=<?php echo $v['p_id']?>">参数详情</a></td>
		</tr>
<?php 
		}
	}
?>
		<tr>
			<td colspan="7" class="td25">
				<input type='button' class="btn delete" value="删除" />
				<input type='button' class="btn edit" value="编辑" />
			</td>
		</tr>
	</tbody>
</table>
</form>
</div>
</div>
</body>
</html>
<script type="text/javascript" src="../Public/static/js/jquery.js"></script>
<script type="text/javascript">
$('input.delete').click(function(){
	if(!$('input:checked').val()){
		alert('请先选择需要删除的版块内容')
		return false;
	}
	if(confirm('确认删除吗?')){
		location.href="?act=del&id="+$('input:checked').val();	
	}
})
$('input.edit').click(function(){
	if($('input:checked').val()){
		location.href="product_add.php?id="+$('input:checked').val()
	}else{
		alert('请先选择需要操作的信息')
	}
	
})
</script>
